/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('jeepproduct', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model Bod {
  step?: bytes(name='Step'),
}

model ErrorCode {
  errorCode?: [ bytes ](name='ErrorCode'),
  errorMessage?: bytes(name='ErrorMessage'),
}

model MyStruct {
  oneParam?: boolean(name='OneParam'),
}

model GroupChildValue = {
  subString?: string(name='SubString'),
  subNuber?: string(name='SubNuber'),
}

model MapFlatArratStringCopyValue = {
  vist?: string(name='Vist'),
}

model MapFlatArratStringCopyCopyValue = {
  vist?: map[string]MapFlatArratStringCopyCopyValueVistValue(name='Vist'),
}

model PublishCatCopyChildValue = {
  trust?: map[string][ string ](name='Trust'),
}

model MapFlatArratStringCopyCopyValueVistValue = {
  blue?: string(name='Blue'),
}

model BluesRequest {
  five?: string(name='Five'),
  four?: string(name='Four'),
  one?: string(name='One'),
  requestAge?: int32(name='RequestAge'),
  requestName?: string(name='RequestName'),
  seven?: string(name='Seven'),
  six?: string(name='Six'),
  three?: string(name='Three'),
  two?: string(name='Two'),
}

model BluesResponseBody = {
  blue?: string(name='Blue'),
  requestId?: string(name='RequestId'),
  result?: boolean(name='result'),
  status?: string(name='status'),
}

model BluesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: BluesResponseBody(name='body'),
}

async function bluesWithOptions(request: BluesRequest, runtime: Util.RuntimeOptions): BluesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.five)) {
    query['Five'] = request.five;
  }
  if (!Util.isUnset(request.four)) {
    query['Four'] = request.four;
  }
  if (!Util.isUnset(request.one)) {
    query['One'] = request.one;
  }
  if (!Util.isUnset(request.requestAge)) {
    query['RequestAge'] = request.requestAge;
  }
  if (!Util.isUnset(request.requestName)) {
    query['RequestName'] = request.requestName;
  }
  if (!Util.isUnset(request.seven)) {
    query['Seven'] = request.seven;
  }
  if (!Util.isUnset(request.six)) {
    query['Six'] = request.six;
  }
  if (!Util.isUnset(request.three)) {
    query['Three'] = request.three;
  }
  if (!Util.isUnset(request.two)) {
    query['Two'] = request.two;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'Blues',
    version = '2021-12-13',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function blues(request: BluesRequest): BluesResponse {
  var runtime = new Util.RuntimeOptions{};
  return bluesWithOptions(request, runtime);
}

model GetLastLogByIdRequest {
  five?: string(name='Five'),
  four?: string(name='Four'),
  news?: string(name='News'),
  one?: string(name='One'),
  requestAge?: int32(name='RequestAge'),
  requestName?: string(name='RequestName'),
  seven?: string(name='Seven'),
  six?: string(name='Six'),
  three?: string(name='Three'),
  two?: string(name='Two'),
  weirht?: string(name='Weirht'),
}

model GetLastLogByIdResponseBody = {
  blue?: string(name='Blue'),
  requestId?: string(name='RequestId'),
  result?: boolean(name='result'),
  status?: string(name='status'),
}

model GetLastLogByIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetLastLogByIdResponseBody(name='body'),
}

async function getLastLogByIdWithOptions(request: GetLastLogByIdRequest, runtime: Util.RuntimeOptions): GetLastLogByIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.five)) {
    query['Five'] = request.five;
  }
  if (!Util.isUnset(request.four)) {
    query['Four'] = request.four;
  }
  if (!Util.isUnset(request.news)) {
    query['News'] = request.news;
  }
  if (!Util.isUnset(request.one)) {
    query['One'] = request.one;
  }
  if (!Util.isUnset(request.requestAge)) {
    query['RequestAge'] = request.requestAge;
  }
  if (!Util.isUnset(request.requestName)) {
    query['RequestName'] = request.requestName;
  }
  if (!Util.isUnset(request.seven)) {
    query['Seven'] = request.seven;
  }
  if (!Util.isUnset(request.six)) {
    query['Six'] = request.six;
  }
  if (!Util.isUnset(request.three)) {
    query['Three'] = request.three;
  }
  if (!Util.isUnset(request.two)) {
    query['Two'] = request.two;
  }
  if (!Util.isUnset(request.weirht)) {
    query['Weirht'] = request.weirht;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetLastLogById',
    version = '2021-12-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getLastLogById(request: GetLastLogByIdRequest): GetLastLogByIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getLastLogByIdWithOptions(request, runtime);
}

model TTTResponseBody = {
  requestId?: string(name='RequestId'),
}

model TTTResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TTTResponseBody(name='body'),
}

async function tTTWithOptions(runtime: Util.RuntimeOptions): TTTResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'TTT',
    version = '2021-12-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function tTT(): TTTResponse {
  var runtime = new Util.RuntimeOptions{};
  return tTTWithOptions(runtime);
}

model TestBoyRequest {
  newParam2?: string(name='new-param-2'),
  newParam3?: string(name='new-param-3'),
  newParam4?: string(name='new-param-4'),
  newParam4Copy?: string(name='new-param-4-copy'),
  newParam1?: string(name='newParam1'),
}

model TestBoyResponseBody = {
  requestId?: string(name='RequestId'),
}

model TestBoyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TestBoyResponseBody(name='body'),
}

async function testBoyWithOptions(request: TestBoyRequest, runtime: Util.RuntimeOptions): TestBoyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.newParam2)) {
    query['new-param-2'] = request.newParam2;
  }
  if (!Util.isUnset(request.newParam3)) {
    query['new-param-3'] = request.newParam3;
  }
  if (!Util.isUnset(request.newParam4)) {
    query['new-param-4'] = request.newParam4;
  }
  if (!Util.isUnset(request.newParam4Copy)) {
    query['new-param-4-copy'] = request.newParam4Copy;
  }
  if (!Util.isUnset(request.newParam1)) {
    query['newParam1'] = request.newParam1;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TestBoy',
    version = '2021-12-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function testBoy(request: TestBoyRequest): TestBoyResponse {
  var runtime = new Util.RuntimeOptions{};
  return testBoyWithOptions(request, runtime);
}

model TestByondResponseBody = {
  requestId?: string(name='RequestId'),
}

model TestByondResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TestByondResponseBody(name='body'),
}

async function testByondWithOptions(runtime: Util.RuntimeOptions): TestByondResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'TestByond',
    version = '2021-12-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function testByond(): TestByondResponse {
  var runtime = new Util.RuntimeOptions{};
  return testByondWithOptions(runtime);
}

model TestDocDetailShowErrorRequest {
  serviceName?: string(name='serviceName'),
  functionName?: string(name='functionName'),
  qualifier?: string(name='qualifier'),
}

model TestDocDetailShowErrorResponseBody = {
  resource?: string(name='resource'),
}

model TestDocDetailShowErrorResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TestDocDetailShowErrorResponseBody(name='body'),
}

async function testDocDetailShowErrorWithOptions(request: TestDocDetailShowErrorRequest, runtime: Util.RuntimeOptions): TestDocDetailShowErrorResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TestDocDetailShowError',
    version = '2021-12-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function testDocDetailShowError(request: TestDocDetailShowErrorRequest): TestDocDetailShowErrorResponse {
  var runtime = new Util.RuntimeOptions{};
  return testDocDetailShowErrorWithOptions(request, runtime);
}

model TestErrorRequest {
  arrayFlatMapString?: [[ string ]  ](name='ArrayFlatMapString'),
  group?: {
    child?: map[string]GroupChildValue(name='Child'),
  }(name='Group'),
  knowledgeIds?: [ long ](name='KnowledgeIds'),
  mapFlarMapString?: map[string]object(name='MapFlarMapString'),
  mapFlatArratString?: map[string] [ string ](name='MapFlatArratString'),
  mapFlatArratStringCopy?: map[string]MapFlatArratStringCopyValue(name='MapFlatArratString-copy'),
  mapFlatArratStringCopyCopy?: map[string]MapFlatArratStringCopyCopyValue(name='MapFlatArratString-copy-copy'),
  publishCat?: {
    child?: [ map[string]string ](name='Child'),
  }(name='PublishCat'),
  publishCatCopy?: {
    child?: [[ map[string]PublishCatCopyChildValue ]    ](name='Child'),
  }(name='PublishCat-copy'),
  testParamArrayFlat?: [ string ](name='TestParamArrayFlat'),
  testParamArrayFlatObject?: [ 
    {
      fixedResponseConfig?: {
        config?: float(name='Config'),
        context?: string(name='Context'),
      }(name='FixedResponseConfig'),
      fixedResponseMap?: string(name='FixedResponseMap'),
    }
  ](name='TestParamArrayFlatObject'),
  testParamObjectFlat?: {
    desc?: string(name='Desc'),
  }(name='TestParamObjectFlat'),
  testParamObjectFlat1?: {
    child?: string(name='Child'),
    thunder?: string(name='Thunder'),
  }(name='TestParamObjectFlat1'),
  testParamObjectFlat1Copy?: {
    child?: {
      nice?: string(name='Nice'),
    }(name='Child'),
  }(name='TestParamObjectFlat1-copy'),
  testParamObjectFlat1CopyCopy?: {
    child?: map[string]string(name='Child'),
  }(name='TestParamObjectFlat1-copy-copy'),
  testParamObjectJson?: map[string]string(name='TestParamObjectJson'),
  visityArrayFlat?: [ map[string]string ](name='VisityArrayFlat'),
}

model TestErrorShrinkRequest {
  arrayFlatMapString?: [[ string ]  ](name='ArrayFlatMapString'),
  group?: {
    child?: map[string]GroupChildValue(name='Child'),
  }(name='Group'),
  knowledgeIdsShrink?: string(name='KnowledgeIds'),
  mapFlarMapString?: map[string]object(name='MapFlarMapString'),
  mapFlatArratString?: map[string] [ string ](name='MapFlatArratString'),
  mapFlatArratStringCopy?: map[string]MapFlatArratStringCopyValue(name='MapFlatArratString-copy'),
  mapFlatArratStringCopyCopy?: map[string]MapFlatArratStringCopyCopyValue(name='MapFlatArratString-copy-copy'),
  publishCat?: {
    child?: [ map[string]string ](name='Child'),
  }(name='PublishCat'),
  publishCatCopy?: {
    child?: [[ map[string]PublishCatCopyChildValue ]    ](name='Child'),
  }(name='PublishCat-copy'),
  testParamArrayFlat?: [ string ](name='TestParamArrayFlat'),
  testParamArrayFlatObject?: [ 
    {
      fixedResponseConfig?: {
        config?: float(name='Config'),
        context?: string(name='Context'),
      }(name='FixedResponseConfig'),
      fixedResponseMap?: string(name='FixedResponseMap'),
    }
  ](name='TestParamArrayFlatObject'),
  testParamObjectFlatShrink?: string(name='TestParamObjectFlat'),
  testParamObjectFlat1?: {
    child?: string(name='Child'),
    thunder?: string(name='Thunder'),
  }(name='TestParamObjectFlat1'),
  testParamObjectFlat1Copy?: {
    child?: {
      nice?: string(name='Nice'),
    }(name='Child'),
  }(name='TestParamObjectFlat1-copy'),
  testParamObjectFlat1CopyCopy?: {
    child?: map[string]string(name='Child'),
  }(name='TestParamObjectFlat1-copy-copy'),
  testParamObjectJsonShrink?: string(name='TestParamObjectJson'),
  visityArrayFlat?: [ map[string]string ](name='VisityArrayFlat'),
}

model TestErrorResponseBody = {
  requestId?: string(name='RequestId'),
}

model TestErrorResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TestErrorResponseBody(name='body'),
}

async function testErrorWithOptions(tmpReq: TestErrorRequest, runtime: Util.RuntimeOptions): TestErrorResponse {
  Util.validateModel(tmpReq);
  var request = new TestErrorShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.knowledgeIds)) {
    request.knowledgeIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.knowledgeIds, 'KnowledgeIds', 'json');
  }
  if (!Util.isUnset(tmpReq.testParamObjectFlat)) {
    request.testParamObjectFlatShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.testParamObjectFlat, 'TestParamObjectFlat', 'json');
  }
  if (!Util.isUnset(tmpReq.testParamObjectJson)) {
    request.testParamObjectJsonShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.testParamObjectJson, 'TestParamObjectJson', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.arrayFlatMapString)) {
    query['ArrayFlatMapString'] = request.arrayFlatMapString;
  }
  if (!Util.isUnset(request.group)) {
    query['Group'] = request.group;
  }
  if (!Util.isUnset(request.mapFlarMapString)) {
    query['MapFlarMapString'] = request.mapFlarMapString;
  }
  if (!Util.isUnset(request.mapFlatArratString)) {
    query['MapFlatArratString'] = request.mapFlatArratString;
  }
  if (!Util.isUnset(request.mapFlatArratStringCopy)) {
    query['MapFlatArratString-copy'] = request.mapFlatArratStringCopy;
  }
  if (!Util.isUnset(request.mapFlatArratStringCopyCopy)) {
    query['MapFlatArratString-copy-copy'] = request.mapFlatArratStringCopyCopy;
  }
  if (!Util.isUnset(request.publishCat)) {
    query['PublishCat'] = request.publishCat;
  }
  if (!Util.isUnset(request.publishCatCopy)) {
    query['PublishCat-copy'] = request.publishCatCopy;
  }
  if (!Util.isUnset(request.testParamArrayFlat)) {
    query['TestParamArrayFlat'] = request.testParamArrayFlat;
  }
  if (!Util.isUnset(request.testParamArrayFlatObject)) {
    query['TestParamArrayFlatObject'] = request.testParamArrayFlatObject;
  }
  if (!Util.isUnset(request.testParamObjectFlatShrink)) {
    query['TestParamObjectFlat'] = request.testParamObjectFlatShrink;
  }
  if (!Util.isUnset(request.testParamObjectFlat1)) {
    query['TestParamObjectFlat1'] = request.testParamObjectFlat1;
  }
  if (!Util.isUnset(request.testParamObjectFlat1Copy)) {
    query['TestParamObjectFlat1-copy'] = request.testParamObjectFlat1Copy;
  }
  if (!Util.isUnset(request.testParamObjectFlat1CopyCopy)) {
    query['TestParamObjectFlat1-copy-copy'] = request.testParamObjectFlat1CopyCopy;
  }
  if (!Util.isUnset(request.testParamObjectJsonShrink)) {
    query['TestParamObjectJson'] = request.testParamObjectJsonShrink;
  }
  if (!Util.isUnset(request.visityArrayFlat)) {
    query['VisityArrayFlat'] = request.visityArrayFlat;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.knowledgeIdsShrink)) {
    body['KnowledgeIds'] = request.knowledgeIdsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TestError',
    version = '2021-12-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function testError(request: TestErrorRequest): TestErrorResponse {
  var runtime = new Util.RuntimeOptions{};
  return testErrorWithOptions(request, runtime);
}

model TraceRequest {
  five?: string(name='Five'),
  four?: string(name='Four'),
  mock?: string(name='Mock'),
  mockCopy?: string(name='Mock-copy'),
  one?: string(name='One'),
  requestAge?: int32(name='RequestAge'),
  requestName?: string(name='RequestName'),
  seven?: string(name='Seven'),
  six?: string(name='Six'),
  three?: string(name='Three'),
  two?: string(name='Two'),
}

model TraceResponseBody = {
  blue?: string(name='Blue'),
  requestId?: string(name='RequestId'),
  result?: boolean(name='result'),
  status?: string(name='status'),
}

model TraceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TraceResponseBody(name='body'),
}

async function traceWithOptions(request: TraceRequest, runtime: Util.RuntimeOptions): TraceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.five)) {
    query['Five'] = request.five;
  }
  if (!Util.isUnset(request.four)) {
    query['Four'] = request.four;
  }
  if (!Util.isUnset(request.mock)) {
    query['Mock'] = request.mock;
  }
  if (!Util.isUnset(request.mockCopy)) {
    query['Mock-copy'] = request.mockCopy;
  }
  if (!Util.isUnset(request.one)) {
    query['One'] = request.one;
  }
  if (!Util.isUnset(request.requestAge)) {
    query['RequestAge'] = request.requestAge;
  }
  if (!Util.isUnset(request.requestName)) {
    query['RequestName'] = request.requestName;
  }
  if (!Util.isUnset(request.seven)) {
    query['Seven'] = request.seven;
  }
  if (!Util.isUnset(request.six)) {
    query['Six'] = request.six;
  }
  if (!Util.isUnset(request.three)) {
    query['Three'] = request.three;
  }
  if (!Util.isUnset(request.two)) {
    query['Two'] = request.two;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'Trace',
    version = '2021-12-13',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function trace(request: TraceRequest): TraceResponse {
  var runtime = new Util.RuntimeOptions{};
  return traceWithOptions(request, runtime);
}

